/*
 * @Date: 2023-03-21 15:52:30
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-21 15:54:46
 * @FilePath: \A19\backend\src\api\Get\ApiGetTeacher.ts
 */
import { ApiCall } from "tsrpc";
import { ReqGetTeacher, ResGetTeacher } from "../../shared/protocols/Get/PtlGetTeacher";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqGetTeacher, ResGetTeacher>) {
    // TODO
    const teacherId = call.req.teacher

    const theTeacher = await Global.collection('users').findOne({
        _id:teacherId
    })

    if(!theTeacher) return call.error('不存在')

    call.succ({
        teacher:theTeacher
    })
}